import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { MainComponent } from './pages/main/main.component';
import { NewMessageComponent } from './pages/new-message/new-message.component';
import { WelcomeComponent } from './pages/welcome/welcome.component';

const routes: Routes = [
    {
        path: '',
        children: [
            {
                path: '',
                pathMatch: 'full',
                redirectTo: 'main'
            },
            {
                path: 'main',
                component: MainComponent,
                children: [
                    {
                        path: '',
                        pathMatch: 'full',
                        redirectTo: 'welcome',
                    },
                    {
                        path: 'welcome',
                        component: WelcomeComponent,
                    },
                    {
                        path: 'new-message',
                        component: NewMessageComponent,
                    }
                ]
            },
        ]
    },
    {
        path: 'login',
        component: LoginComponent
    }
];

@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule {
}
